import request from '../utils/request'

/**
 * 发起微信支付
 */
export const createWechatPayment = (params) => {
  // 确保路径是正确的，没有重复的/api
  return request.post('/wechat/pay/create', params)
}

/**
 * 查询支付状态
 */
export const queryPaymentStatus = (params) => {
  // 修复查询状态的URL路径
  if (typeof params === 'string') {
    return request.get(`/payment/status/${params}`)
  }
  
  const { orderId, groupId } = params
  return request.get(`/payment/status/${orderId}`, {
    params: { groupId }
  })
}